<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="box">
        <div class="box">1</div>
        <div class="box">2</div>
        <div class="box">3</div>
    </div>
    
    <!-- 点击box alert 相应下表 -->

    <script>
        var box =document.getElementsByClassName("box")
        for(let i=0;i<box.length;i++ ){
            box[i].onclick=function(){
                alert(i)
            }
        }{
            let girl="musha";
        }
        let yuzong ="bobo";
        {
            let girl ="musha";
            function fn(){
                console.log(girl)
            }
            fn()
        }
    </script>




    <script>
        var box =document.getElementsByClassName("box")
        for(let i=0;i<box.length;i++ ){
            box[i].onclick=function(){
                alert(i)
            }
        }{
            let girl="musha";
        }
        let yuzong ="bobo";
        {
            let girl ="musha";
            function fn(){
                console.log(girl)
            }
            fn()
        }
    </script>
    
    <script>
        var box =document.getElementsByClassName("box")
        for(let i=0;i<box.length;i++ ){
            box[i].onclick=function(){
                alert(i)
            }
        }{
            let girl="musha";
        }
        let yuzong ="bobo";
        {
            let girl ="musha";
            function fn(){
                console.log(girl)
            }
            fn()
        }
    </script>
</body>
</html>